package com.kornero.common.util;

import android.os.Handler;
import android.os.Message;
import android.widget.TextView;

public class HandlerUtil {

    public static Handler valueOf(final TextView textView) {
        return new StringHandler(textView);
    }

    private static class StringHandler extends Handler {
        private final TextView textView;

        private StringHandler(final TextView textView) {
            this.textView = textView;
        }

        @Override
        public void handleMessage(final Message msg) {
            final String text = (String) msg.obj;
            textView.setText(text);
        }
    }
}